<template>
	<view>
		
		<cusUinavVue :title="title" bgColor="#0000ff"></cusUinavVue>
		<!-- <web-view src="https://www.baidu.com/"></web-view> -->
		<button open-type="chooseAvatar" @chooseavatar="handleUserAvatar">获取头像</button>
		{{avatarUrl}}
		<image :src="avatarUrl" mode=""></image>
		<button open-type="feedback">意见反馈</button>
		<input type="nickname" placeholder="点击获取昵称" />
		<up-button @click="logout">退出登录</up-button>
	</view>
	<cusTabVue></cusTabVue>
</template>

<script setup>
	import cusUinavVue from '../../components/cus-uinav/cus-uinav.vue';
	import cusTabbarVue from '../../components/cus-tabbar/cus-tabbar.vue';
	import cusTabVue from '../../components/cus-tab/cus-tab.vue';
	import {onLoad} from '@dcloudio/uni-app'
import { ref } from 'vue';
const title = ref('')
onLoad(() => {
	const token = uni.getStorageInfoSync('token')
	if(!token) {
		uni.navigateTo({
			url: '/pagesA/codeLogin/codeLogin'
		})
	}
})
title.value = uni.getStorageSync('phone')

	const avatarUrl = ref('')
	const handleUserAvatar = (res) => {
		console.log(res)
		avatarUrl.value = res.detail.avatarUrl
	}
	const logout = () => {
		console.log('退出登录')
		uni.clearStorageSync()
		uni.navigateTo({
			url: '/pagesA/codeLogin/codeLogin'
		})
	}
</script>

<style>
</style>